dofile ("libColor.lua")

function barrePixels(scr, x, y, val, val_max, R1, V1, B1, R2, V2, B2)

if val > val_max then local val = val_max end

if R2  == nil and V2 == nil and B2 == nil then 
screen.drawFillRect(scr, x, y, x+val_max, y+20, Color.invers(R1, V1, B1))
else
screen.drawFillRect(scr, x, y, x+val_max, y+20, Color.new(R2, V2, B2))
end

screen.drawFillRect(scr, x, y, x+val, y+20, Color.new(R1, V1, B1))

end

function barrePourcent(scr, x, y, pourcent, affiche, R1, V1, B1, R2, V2, B2, long, haut)

if pourcent > 100 then local pourcent = 100 end

if long == nil then

local long = 200

else

local long = long

end

if haut == nil then

local haut = 20

else

local haut = haut

end

if R2  == nil and V2 == nil and B2 == nil then 
screen.drawFillRect(scr, x, y, x+long, y+haut, Color.invers(R1, V1, B1))
else
screen.drawFillRect(scr, x, y, x+long, y+haut, Color.new(R2, V2, B2))
end

screen.drawFillRect(scr, x, y, x+pourcent/100*long, y+haut, Color.new(R1, V1, B1))

if affiche == true then

screen.print(scr, x+long/2, y+haut/2, pourcent..' %', Color.invers(R1,V1,B1))

end

end
